<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
  </head>
  <body>
    <script type="text/javascript">
      const _sampleDeepClone = (target) => {
        // 补全代码
        if (typeof target == 'Object' && target !== null) {
          var result = Array.isArray(target) ? [] : {}
          for (prop in target) {
            result[prop] = _sampleDeepClone(target[prop])
          }
          return result
        } else {
          return target
        }
      }
      console.log(
        _sampleDeepClone({
          username: {
            ch: '汉语',
            en: '英语',
          },
          arr: [{ age: 20 }, { gander: '男' }],
        })
      )
    </script>
  </body>
</html>
